Skip to content

Conversation

@tuliom
Copy link
Contributor

@tuliom tuliom commented Sep 16, 2025

Add an explanation on how to use RUNTIMES__CMAKE_CXX_FLAGS in
order to specify different compiler flags for OpenMP device libraries.

Since commit be6f110 we lost a few
workarounds that prevented CPU-specific flags to leak from CXXFLAGS to a
binary targetting GPUs causing errors and/or warnings.

Re-add those workarounds and expand them with -mtune,
-mbranch-protection and -fcf-protection.
Copy link
Contributor

@jhuber6 jhuber6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are inherited from the global version, the correct solution (I think) is to do -DRUNTIMES_amdgcn-amd-amdhsa_CMAKE_CXX_FLAGS="" or something. If that works it might be reasonable behavior to put in the cache file.

I wonder if in the general case we should force users to be more specific on which flags are intended for the runtimes or not, but that might be a little user hostile. @petrhosek WDYT?

Add an explanation on how to use RUNTIMES_<triple>_CMAKE_CXX_FLAGS in
order to specify different compiler flags for OpenMP device libraries.
@tuliom
Copy link
Contributor Author

tuliom commented Sep 16, 2025

@jhuber6 Thank you! That worked.
I modified this PR in order to document this. Could you review it again, please?

@tuliom tuliom changed the title [OpenMP] Avoid using CPU-specific flags on GPU [OpenMP] Document how to specify flags to device libraries Sep 16, 2025
@tuliom tuliom requested a review from jhuber6 September 16, 2025 20:52
Copy link
Contributor

@jhuber6 jhuber6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, looks good. I need to get around to writing some more comprehensive documentation on the runtimes builds now that I'm trying to push everything further in that direction.

@jhuber6 jhuber6 merged commit 66524ee into llvm:main Sep 16, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

openmp:libomp OpenMP host runtime openmp:libomptarget OpenMP offload runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants